storage:
  dbPath: {{ mongod_path }}/mongod
  journal:
    enabled: true
  engine: {{ mongod_arg.engine }}
{% if mongod_arg.engine == 'wiredTiger' %}
  wiredTiger:
    engineConfig:
      cacheSizeGB: {{ mongod_arg.wiredTiger_cacheSizeGB }}
      checkpointSizeMB: {{ mongod_arg.wiredTiger_checkpointSizeMB }}
      statisticsLogDelaySecs: {{ mongod_arg.wiredTiger_statisticsLogDelaySecs }}
      journalCompressor: {{ mongod_arg.wiredTiger_compressors }}
      directoryForIndexes: {{ mongod_arg.wiredTiger_directoryForIndexes | bool | to_json }}
    collectionConfig:
      blockCompressor: {{ mongod_arg.wiredTiger_compressors }}
    indexConfig:
      prefixCompression: {{ mongod_arg.wiredTiger_prefixCompression | bool | to_json }}
setParameter:
    wiredTigerConcurrentReadTransactions: {{ mongod_arg.wiredTiger_ConcurrentReadTransactions }}
    wiredTigerConcurrentWriteTransactions: {{ mongod_arg.wiredTiger_ConcurrentWriteTransactions }}
{% elif mongod_arg.engine == 'rocksdb' %}
  rocksdb:
    compression: {{ mongod_arg.rocksdb_compressors }}
    maxWriteMBPerSec: {{ mongod_arg.rocksdb_maxWriteMBPerSec }}
    crashSafeCounters: {{ mongod_arg.rocksdb_crashSafeCounters }}
    counters: {{ mongod_arg.rocksdb_counters }}
    singleDeleteIndex: {{ mongod_arg.rocksdb_singleDeleteIndex }}
{% else %}
{% endif %}

# where to write logging data.
systemLog:
  destination: file
  logAppend: true
  path: /var/log/mongo/mongod.log
  logRotate: reopen

processManagement:
  fork: true
  pidFilePath: /var/run/mongod.pid

# network interfaces
net:
  port: {{ mongod_port }}
  bindIp: {{ ansible_default_ipv4.address }}
{% if mongod_version == '34' %}
  http:
    enabled: {{ mongod_arg.http | bool | to_json }}
    RESTInterfaceEnabled: {{ mongod_arg.http | bool | to_json }}
{% endif %}

security:
  redactClientLogData: {{ mongod_arg.redactClientLogData | bool | to_json }}
{% if mongod_encryption | bool %}
  enableEncryption: true
  encryptionCipherMode: {{ mongod_arg.encryptionCipherMode | default('AES256-CBC') }}
  encryptionKeyFile: {{ mongod_path }}/mongod/mongodb.key
{% endif %}

#operationProfiling:

{% if ( mongod_replset is defined ) and ( mongod_replset != 'Non-ReplicaSet' ) %}
replication:
  oplogSizeMB: {{ mongod_arg.oplogSizeMB| int }}
  replSetName: {{ mongod_replset | upper }}
{% endif %}

#sharding:

## Enterprise-Only Options:

auditLog:
  destination: {{ mongod_arg.auditlog }}
  format: JSON
  filter: '{ atype: { $in: [ "{{ '", "'.join(vars['mongod_audit_log_commands']) }}" ] } }'
  path: /var/log/mongo/audit.log

#snmp:
